/**
 */
package fUML.Semantics.Activities.CompleteStructuredActivities.impl;

import fUML.Semantics.Activities.CompleteStructuredActivities.ClauseActivation;
import fUML.Semantics.Activities.CompleteStructuredActivities.CompleteStructuredActivitiesPackage;
import fUML.Semantics.Activities.CompleteStructuredActivities.ConditionalNodeActivation;

import fUML.Syntax.Activities.CompleteStructuredActivities.Clause;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Conditional Node Activation</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fUML.Semantics.Activities.CompleteStructuredActivities.impl.ConditionalNodeActivationImpl#getClauseActivations <em>Clause Activations</em>}</li>
 *   <li>{@link fUML.Semantics.Activities.CompleteStructuredActivities.impl.ConditionalNodeActivationImpl#getSelectedClauses <em>Selected Clauses</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConditionalNodeActivationImpl extends StructuredActivityNodeActivationImpl implements ConditionalNodeActivation {
	/**
	 * The cached value of the '{@link #getClauseActivations() <em>Clause Activations</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClauseActivations()
	 * @generated
	 * @ordered
	 */
	protected EList<ClauseActivation> clauseActivations;

	/**
	 * The cached value of the '{@link #getSelectedClauses() <em>Selected Clauses</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSelectedClauses()
	 * @generated
	 * @ordered
	 */
	protected EList<Clause> selectedClauses;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConditionalNodeActivationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CompleteStructuredActivitiesPackage.Literals.CONDITIONAL_NODE_ACTIVATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ClauseActivation> getClauseActivations() {
		if (clauseActivations == null) {
			clauseActivations = new EObjectContainmentWithInverseEList<ClauseActivation>(ClauseActivation.class, this, CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS, CompleteStructuredActivitiesPackage.CLAUSE_ACTIVATION__CONDITIONAL_NODE_ACTIVATION);
		}
		return clauseActivations;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Clause> getSelectedClauses() {
		if (selectedClauses == null) {
			selectedClauses = new EObjectResolvingEList<Clause>(Clause.class, this, CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__SELECTED_CLAUSES);
		}
		return selectedClauses;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ClauseActivation getClauseActivation(Clause clause) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void runTest(Clause clause) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void selectBody(Clause clause) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getClauseActivations()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS:
				return ((InternalEList<?>)getClauseActivations()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS:
				return getClauseActivations();
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__SELECTED_CLAUSES:
				return getSelectedClauses();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS:
				getClauseActivations().clear();
				getClauseActivations().addAll((Collection<? extends ClauseActivation>)newValue);
				return;
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__SELECTED_CLAUSES:
				getSelectedClauses().clear();
				getSelectedClauses().addAll((Collection<? extends Clause>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS:
				getClauseActivations().clear();
				return;
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__SELECTED_CLAUSES:
				getSelectedClauses().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__CLAUSE_ACTIVATIONS:
				return clauseActivations != null && !clauseActivations.isEmpty();
			case CompleteStructuredActivitiesPackage.CONDITIONAL_NODE_ACTIVATION__SELECTED_CLAUSES:
				return selectedClauses != null && !selectedClauses.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ConditionalNodeActivationImpl
